<template>
  <div class="layout">
    <el-form :inline="true" :model="formData" class="zw-search-form" label-position="right" label-width="auto">
      <el-row class="el-row" :gutter="20" style="margin-left: -12px; margin-right: -12px">
        <el-col :span="8">
          <el-form-item label="客户名称">
            <el-input v-model="formData.cust_name" placeholder="请输入客户名称" :suffix-icon="Search" clearable></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="接替状态">
            <el-select v-model="formData.takeover_status" placeholder="请选择接替状态">
              <el-option v-for="item in takeover_list" :key="item.id" :label="item.name" :value="item.id"> </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item>
            <el-button type="primary" @click="search">查询</el-button>
            <el-button  @click="empty">清空</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script lang="ts" setup>
import { reactive, ref, onMounted, computed, watch } from 'vue'
const emit = defineEmits({
  onSearch: null
})
const formData = ref({
  cust_name: '',
  takeover_status: ''
})
//接替状态， 1-接替完毕 2-等待接替 3-客户拒绝 4-接替成员客户达到上限
const takeover_list = ref([
  {
    id: '',
    name: '全部'
  },
  {
    id: 1,
    name: '接替完毕'
  },
  {
    id: 2,
    name: '等待接替'
  },
  {
    id: 3,
    name: '客户拒绝'
  },
  {
    id: 4,
    name: '接替成员客户达到上限'
  },
  {
    id: 5,
    name: '接替失败'
  }
])
const search = () => {
  emit('onSearch', formData.value)
}
const empty = () => {
  formData.value.cust_name = ''
  formData.value.takeover_status = ''
  search()
}
</script>
<style lang="scss" scoped>
.layout {
  .form-inline {
    height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9f9f9;
    padding: 0 20px;
    .el-form-item {
      margin-bottom: 0;
    }
  }
}
.zw-search-form {
  padding: 16px;
  margin-bottom: 16px;
  background-color: #f9f9f9;
  .el-row {
    display: flex;
    flex-wrap: wrap;
    position: relative;
    box-sizing: border-box;
    margin: -8px -10px;
    .el-col {
      margin: 8px 0;
      &:last-of-type {
        flex: auto;
        text-align: right;
      }
      .el-form-item {
        margin-bottom: 0;
        width: 100%;
        .el-form-item__label-wrap {
          .el-form-item__label {
            font-size: 14px;
            font-family: STHeitiSC-Light, STHeitiSC;
            font-weight: 300;
            color: #33302d;
          }
        }

        .el-form-item__content {
          .el-input,
          .el-select,
          .el-date-editor {
            width: 100%;
          }
        }
      }
    }
  }
}
</style>
